# coding: UTF-8

def display():
    print("+---+---+---+")
    cell_line = "|"
    for i in range(9):
        cell_line += " " + cells[i] + " |"
        if i % 3 == 2:
            print(cell_line)
            cell_line = "|"
            print("+---+---+---+")

def mark(num):
    if num % 2:         # 2 で割って余りがあったら
        return "X"
    else:
        return "O"

if __name__ == '__main__':
    cells = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
    count = 0
    for i in range(9):
        row = input("Rows? : ")
        column = input("Column? : ")
        cells[(row - 1) * 3 + (column - 1)] = mark(count)    # ここを関数の呼び出しに変更
        display()
        count += 1
